package shape2D;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.effect.Lighting;
import javafx.stage.Stage;
import javafx.scene.layout.*;
import javafx.scene.shape.Circle;

// 圆
public class CircleDemo extends Application {
	private Pane root = new Pane();
	private Circle circle;
	
	public static void main(String[] args) {
		Application.launch(args);   
	}
	
	@Override
	public void start(Stage stage) {
		
		root.setStyle("-fx-border-color: red; -fx-background-color: lightgreen"); 	// 红色边界
		
		circle = new Circle(100);
		circle.setStrokeWidth(10);
//		circle.setStyle("-fx-stroke: yellow; -fx-fill: white;");      // 继承Shape类的用-fx-fill
		circle.setEffect(new Lighting());	// 设置亮光效果
		root.getChildren().addAll(circle);
		
		Scene scene = new Scene(root, 300, 300);
		stage.setScene(scene);
		stage.show();
		
		// 监听
		circle.centerXProperty().bind(root.widthProperty().divide(2));      // (绑定)人为拉大也可以
		circle.centerYProperty().bind(root.heightProperty().divide(2));
	}
}

